package biznussoft.metercor.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import biznussoft.metercor.R;
import biznussoft.metercor.model.ServiceOrderModel;



public class ServiceOrderAdapter extends BaseAdapter {
	ArrayList<ServiceOrderModel> listdata;
	Context mContext;
	public ServiceOrderAdapter(Context context, ArrayList<ServiceOrderModel> list) {
		this.listdata = list;
		this.mContext = context;
	}

	public int getCount() {
		return listdata.size();
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}
	
	public class ViewHolder{             
		public TextView name;                 
		public TextView phno;                
		public TextView Email;            
		public TextView title;             
//		public ImageView image;
	}

	public View getView(int position, View v, ViewGroup parent) {
		ViewHolder holder;
		if(v == null){
			holder = new ViewHolder();
			LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = inflator.inflate(R.layout.common_details_page, null);
			holder.name  = (TextView) v.findViewById(R.id.text1);
			holder.title  = (TextView) v.findViewById(R.id.text2);
			holder.Email = (TextView) v.findViewById(R.id.text3);
//			holder.image = (ImageView) v.findViewById(R.id.imageview);
			v.setTag(holder);
		}else{
			holder = (ViewHolder) v.getTag();
		}
		
		ServiceOrderModel bean = listdata.get(position);
			holder.name.setText(bean.getName());
			holder.title.setText(bean.getAccountName());
			holder.Email.setText(bean.getContact());
//			holder.image.setImageResource(R.drawable.servicet);
			
//			Log.i("NCS","Records  :"+bean.getInstallesProduct()+" : "+bean.getProductId2()+" : "+bean.getAgreementName()+" : "+bean.getEntitleGroupName()+" : "+bean.getServiceName()+" : "+bean.getServiceDescription());
		
		return v;
	}

}
